<template>
  <el-select v-model="value" placeholder="请选择" @change="tbadata">
    <el-option
      v-for="(item,index) in options"
      :key="index"
      :label="item.className"
      :value="item.classId"
    ></el-option>
  </el-select>
</template>

<script>
export default {
  props: {
    valaue: {
      type: [Number, String]
    }
  },
  data() {
    return {
      value: this.valaue,
      options: []
    };
  },
  watch: {
    valaue: function(newVal) {
      this.value = newVal;
    },
   value:function(newVal){
  console.log(newVal)
   }
  },
  methods: {
    tbadata(e) {
      this.$emit("func", e)
    }
  },
  //钩子函数--加载后
  mounted() {
    // this.valaue=this.value
    this.$get("/api/Class/GetAllClass").then(reject => {
      this.options = reject.data;
    });
  }
};
</script>